package com.example.droolstool.module;

import com.example.droolstool.factory.ExecuteDrlAssembleFactory;
import com.example.droolstool.service.ExecuteDrlAssembleServerImpl;
import com.fasterxml.jackson.annotation.JsonFilter;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import lombok.ToString;

import java.util.List;
import java.util.Map;

/**
 * @Author 赵云龙
 * @Date 2020/6/26
 * @Description TODO
 */

@Data
@ToString
public class DrlMessageModule {


    @JsonProperty(value = "from")
    List<String> fromId;

    List<String> toId;

    /**
     * 已经执行过的from
     */
    List<String> executedFrom;

    String id;

    String state;

    String type;

    String salience;

    Map<String, Object> requestParams;

    Map<String, Object> respondParams;

    /**
     * 执行过
     */
    Boolean executed;

    public Boolean getExecuted() {
        return executed == null ? Boolean.FALSE : executed;
    }

    public void executeDrlServer(){
        ExecuteDrlAssembleServerImpl executeDrlAssembleServer = ExecuteDrlAssembleFactory.getExecuteDrlAssembleServerImpl();
        executeDrlAssembleServer.ExeServerAssemble(this);
    }

    public void executeFinish(){
        System.out.println("服务调度  运行结束！");
    }

    @Override
    public String toString() {
        return "DrlMessageModule{" +
                "fromId=" + fromId +
                ", toId=" + toId +
                ", executedFrom=" + executedFrom +
                ", id='" + id + '\'' +
                ", state='" + state + '\'' +
                ", type='" + type + '\'' +
                ", salience='" + salience + '\'' +
                ", requestParams=" + requestParams +
                ", respondParams=" + respondParams +
                ", executed=" + executed +
                '}';
    }
}
